//
//  OrderContentCell.m
//  WuJieLive
//
//  Created by iMac on 2017/12/19.
//  Copyright © 2017年 zhk. All rights reserved.
//

#import "OrderContentCell.h"
#import "OrderTableCell.h"
#import "OrderDetailModel.h"

@implementation OrderContentCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupView];
    }
    return self;
}

- (void)setupView
{
    self.tableview = [[UITableView alloc]init];
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    [self.contentView addSubview:self.tableview];
    [self.tableview registerNib:[UINib nibWithNibName:@"OrderTableCell" bundle:nil] forCellReuseIdentifier:@"OrderTableCell"];
    [self.tableview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.offset(0);
    }];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    OrderTableCell * cell = [tableView dequeueReusableCellWithIdentifier:@"OrderTableCell" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (self.dataArray.count > 0) {
        OrderDetailModel * model = self.dataArray[indexPath.row];
        [cell bindDataWithModel:model];
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 121;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

@end
